<?php
if ($_FILES) {
    
  
  if(!file_exists('./files/'.$_FILES['file']['name'])) {
    //新文件
    $res = move_uploaded_file($_FILES['file']['tmp_name'],'./files/'.$_FILES['file']['name']);
  } else {

    //合成
    $res = file_put_contents('./files/'.$_FILES['file']['name'],file_get_contents($_FILES['file']['tmp_name']),FILE_APPEND);
    unlink($_FILES['file']['tmp_name']);
  }
 
  if($res){

    echo json_encode(['code'=>200]);
  }else{
    echo json_encode(['code'=>100]);
  }
//   echo 'ok';
//   exit;
}
?>